﻿using com.guojin.mj.net.message;
using com.guojin.mj.net.message.login;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
using com.guojin.core.io.message;
using com.guojin.mj.net.message.club;
using com.guojin.mj.net.message.game;
using UnityEngine.UI;
using DG.Tweening;

public class GameController : MonoBehaviour
{
    private static GameController instance;
    public static GameController GetInstance()
    {
        return instance;
    }
    void Awake()
    {
        instance = this;
    }

    #region  //规则信息
    public const string RoomName = "RoomName";
    public const string EmpowerTakeIn = "EmpowerTakeIn";
    public const string AutoCompute = "AutoCompute";
    public const string MaxPlayerCount = "MaxPlayerCount";
    public const string VieForZhuang = "VieForZhuang";
    public const string SameNiu = "SameNiu";
    public const string OneTimesBet = "OneTimesBet";
    public const string CreateRoomType = "CreateRoomType";
    public const string BotScore = "BotScore";
    public const string MinTakeInScore = "MinTakeInScore";
    public const string MaxTakeInScore = "MaxTakeInScore";
    public const string ServiceCharge = "ServiceCharge";
    public const string RoomExistenceTime = "RoomExistenceTime";
    public const string ClubOrLianMengID = "ClubOrLianMengID";
    #endregion 

    // 玩家的位置信息
    public  int[] intArr = new int[6];         
    public void InitPlayerPosition()
    {
        int[] ARR0 = { 0, 1, 2, 3, 4, 5,};
        int[] ARR1 = { 5, 0, 1, 2, 3, 4,};
        int[] ARR2 = { 4, 5, 0, 1, 2, 3,};
        int[] ARR3 = { 3, 4, 5, 0, 1, 2,};
        int[] ARR4 = { 2, 3, 4, 5, 0, 1,};
        int[] ARR5 = { 1, 2, 3, 4, 5, 0,};

        switch (GameData.GetInstance().locationIndex)
        {
            case -1:
                intArr = ARR0;
                break;
            case 0:
                intArr = ARR0;
                break;
            case 1:
                intArr = ARR1;
                break;
            case 2:
                intArr = ARR2;
                break;
            case 3:
                intArr = ARR3;
                break;
            case 4:
                intArr = ARR4;
                break;
            case 5:
                intArr = ARR5;
                break;
        }
    }

    //保存玩家倒计时，用于房间刷新后同步(userId, time)
    public Dictionary<string, float > downTimeDic = new Dictionary<string, float>();


    //规则
    public Dictionary<string, string> optionDic = new Dictionary<string, string>();
    public void SaveOptionsToOptionDic(List<OptionEntry> options)
    {
        optionDic.Clear();

        for (var i = 0; i < options.Count; i++)
        {
            optionDic.Add(options[i].key, options[i].value);
        }

        GameRoomModel.GetInstance().RoomName = optionDic[RoomName];
        GameRoomModel.GetInstance().EmpowerTakeIn = bool.Parse(optionDic[EmpowerTakeIn]);
        GameRoomModel.GetInstance().AutoCompute = bool.Parse(optionDic[AutoCompute]);
        GameRoomModel.GetInstance().VieForZhuang = bool.Parse(optionDic[VieForZhuang]);
        GameRoomModel.GetInstance().MaxPlayerCount = int.Parse(optionDic[MaxPlayerCount]);
        GameRoomModel.GetInstance().SameNiu = int.Parse(optionDic[SameNiu]);
        GameRoomModel.GetInstance().OneTimesBet = int.Parse(optionDic[OneTimesBet]);
        GameRoomModel.GetInstance().RoomType = int.Parse(optionDic[CreateRoomType]);                       //房间类型   0普通房间  1俱乐部开房  2联盟房间
        GameRoomModel.GetInstance().BotScore =  int.Parse(optionDic[BotScore]);                                       //底分            2/4/10/20/50/100/200
        GameRoomModel.GetInstance().MinTakeInScore = int.Parse(optionDic[MinTakeInScore]);
        GameRoomModel.GetInstance().MaxTakeInScore = int.Parse(optionDic[MaxTakeInScore]);                              //带入积分
        GameRoomModel.GetInstance().RoomExistenceTime = int.Parse(optionDic[RoomExistenceTime]);                  //房间存在时间（分钟）
        GameRoomModel.GetInstance().ClubOrLianMengID = optionDic[ClubOrLianMengID];
        GameRoomModel.GetInstance().mingpaimos = optionDic["mingpai"];
        Debug.Log("GameRoomModel.GetInstance().mingpaimos"+ GameRoomModel.GetInstance().mingpaimos);
        GameRoomModel.GetInstance().AutoNiu = false;
        GameRoomModel.GetInstance().AutoBet = false;
        
        if (GameRoomModel.GetInstance().AutoCompute == true)
        {
            GameRoomPage.GetInstance().OpenAutoNiu();
        }
    }


    public void OnReceive122(string msg, Message data)
    {
        ReadyToStartTheGameRet pr = (ReadyToStartTheGameRet)data;

        //对应玩家准备，显示准备UI，动画消失
       // GameRoomModel.GetInstance().playerDic[pr.LocationIndex].IsReady = true;

        //如果尚未开始游戏，遍历判断是否显示开始游戏
        if (GameRoomModel.GetInstance().RoomState == 0)
            GameRoomController.GetInstance().ShowStartBtnState();
    }
    public void Get733(string msg, Message date)
    {
        ZFBRet req = (ZFBRet)date;
        TooL.WenXinTiSi("恭喜您购买成功！");
        GameObject MYZhuanShis = GameObject.Find("MYZhuanShi");
        if (MYZhuanShis)
        {
            MYZhuanShis.GetComponent<Text>().text = req.body.ToString();
        }
        GameData.GetInstance().Zhuan = int.Parse(req.body);
        Debug.Log("ZFBRet=>>" + req.body);
    }
    public void OnRecive123(string msg, Message data)
    {
        DealCardsRet gd = (DealCardsRet)data;

        GameRoomPage.GetInstance().SetStartBtn(0);
        GameRoomPage.GetInstance().SetInviteBtn(0);

        GameRoomController.GetInstance().GameStartInitPlayerInfo(gd);

        if (gd.zhuangLocationIndex == -1)
        {
            Debug.Log("服务器发送庄locationIndex为-1");
        }
        else
        {
            GameRoomModel.GetInstance().zhuangIndex = gd.zhuangLocationIndex;
            GameRoomModel.GetInstance().playerDic[gd.zhuangLocationIndex].ShowZhuang(true);
        }

        GameRoomController.GetInstance().StartGame();

        DealCard(gd);
    }
    public void Get731(string msg, Message date)
    {
        ZFBPayRet req = (ZFBPayRet)date;
#if UNITY_ANDROID
        LoginAndShare.Controller.callAndroidJava("ZfbPay", req.body);
#elif UNITY_IPHONE
        LoginAndShare.Controller.CallIosZfb(req.body);
#endif
        Debug.Log("ZFBPayRet=>>" + req.body);
    }
    public void DealCard(DealCardsRet gd)
    {
        for (int i = 0; i < gd.cardMsg.Count; i++)
        {
            GameRoomModel.GetInstance().playerDic[gd.cardMsg[i].LocationIndex].AddCards(gd.cardMsg[i].Cards);
            GameRoomModel.GetInstance().playerDic[gd.cardMsg[i].LocationIndex].cardType = gd.cardMsg[i].CardType;
        }
        if (GameRoomModel.GetInstance().mingpaimos=="true")
        {
            StartCoroutine("shoufourcard");
        }


    }
    IEnumerator shoufourcard()
    {
        yield return new WaitForEndOfFrame();
        if (GameRoomModel.GetInstance().playerDic.ContainsKey(GameData.GetInstance().locationIndex))
        {
            Debug.Log("显示4张牌");
            GameRoomModel.GetInstance().playerDic[GameData.GetInstance().locationIndex].ShowCardValueFour();
        }
    }
        public void OnReceive128(string msg, Message data)
    {
        GameUserInfoRet gui = (GameUserInfoRet)data;

        if (gui.userId.ToString() != GameData.GetInstance().userID)
        {
            if (GameRoomModel.GetInstance().waitPlayerDic.ContainsKey(gui.userId.ToString()))
            {
                GameRoomModel.GetInstance().waitPlayerDic[gui.userId.ToString()].SaveUserInfoToThis(gui);
            }
            else if(GameRoomModel.GetInstance().playerDic.ContainsKey(gui.locationIndex))
            {
                GameRoomModel.GetInstance().playerDic[gui.locationIndex].SaveUserInfoToThis(gui);
            }
            else
            {
                Player player = new Player();

                player.SaveUserInfoToThis(gui);

                GameRoomModel.GetInstance().waitPlayerDic.Add(gui.userId.ToString(), player);  
            }
        }
        else
        {
            Debug.Log("收到自己的12.8, return掉！");
        }
    }

    public void OnReceive1211(string msg, Message data)
    {
        PlayCardRet pc = (PlayCardRet) data;

        GameRoomModel.GetInstance().playerDic[pc.LocationIndex].DealState = 1;

        if (pc.LocationIndex == GameData.GetInstance().locationIndex)
        {
            GameRoomModel.GetInstance().playerDic[pc.LocationIndex].ShowCardBaseCardType(pc.Cards);
            GameRoomModel.GetInstance().playerDic[GameData.GetInstance().locationIndex].ShowCardPitchBaseCardType(pc.CardType);
            GameRoomModel.GetInstance().playerDic[GameData.GetInstance().locationIndex].ShowCardType(true, pc.CardType);
            GameRoomModel.GetInstance().playerDic[pc.LocationIndex].ShowReady(true);
            GameRoomPage.GetInstance().SetNoNiuBtn(0);
        }
        else
        {
            GameRoomModel.GetInstance().playerDic[pc.LocationIndex].ShowReady(true);
        }
    }

    public void OnReceive1213(string msg, Message data)
    {
        BetInfoRet bs = (BetInfoRet)data;

        CheckDeleteBetPage(bs.LocationIndex);

        GameRoomModel.GetInstance().playerDic[bs.LocationIndex].betState = bs.BetType;
        GameRoomModel.GetInstance().playerDic[bs.LocationIndex].BetScore = bs.BetScore;
    }

    public void OnReceive1215(string msg, Message data)
    {
        if (GameObject.Find("BetPage(Clone)"))
        {
            GameObject.Find("BetPage(Clone)").GetComponent<BetPage>().CloseBtnClick();
        }

        GameRoomModel.GetInstance().RoomState = 3;
        DownTime.GetInstance().StartDownTime(15);
        GameRoomController.GetInstance().CheckAutoNiuOrPlayerDeal();
    }

    private void CheckDeleteBetPage(int locationIndex)
    {
        if (locationIndex == GameData.GetInstance().locationIndex)
        {
            if (GameObject.Find("BetPage(Clone)"))
            {
                GameObject.Find("BetPage(Clone)").GetComponent<BetPage>().CloseBtnClick();
            }
        }
    }

    private void DeleteDownTimeAndSelect(int locationIndex)
    {
        //GameRoomModel.GetInstance().playerDic[locationIndex].SetDownTime(false, 0);
        //GameRoomModel.GetInstance().playerDic[locationIndex].IsSelect = false;
    }

    //循环删除各种战斗场景预设体
    public void DeleteAllExceptGameHall()
    {
        GameObject obj = GameObject.Find("Canvas/addNode");
        //for (int i = 0; i < obj.transform.childCount;)
        //{
        //    //if (obj.transform.GetChild(i).name != "GameHall(Clone)")
        //    //{
        //    //    Debug.Log("删除" + obj.transform.GetChild(i).name);
        //    //    UnityEngine.Object.DestroyImmediate(obj.transform.GetChild(i).gameObject);
        //    //}
        //    //else
        //    //{
        //    //    i++;
        //    //}
        //        Debug.Log("删除" + obj.transform.GetChild(i).name);
        //       UnityEngine.Object.DestroyImmediate(obj.transform.GetChild(i).gameObject);
        //       i++;
        //}
        DestroyChildren(obj.transform);
        StartCoroutine("WaitFrameEnd");
 
    }
    IEnumerator WaitFrameEnd()
    {
        yield return new WaitForEndOfFrame();
        yield return new WaitForEndOfFrame();
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject objs) =>
           {
               objs.GetComponent<GameHallPanel>().InformationSetting();
           });
    }
    void DestroyChildren(Transform t)
    {
        bool isPlaying = Application.isPlaying;

        while (t.childCount != 0)
        {
            Transform child = t.GetChild(0);

            if (isPlaying)
            {
                child.parent = null;
                UnityEngine.Object.Destroy(child.gameObject);
            }
            else UnityEngine.Object.DestroyImmediate(child.gameObject);


        }
    }
    public void OnReceive1232(string msg, Message data)
    {
        SitDownRet sdr = (SitDownRet) data;

        if (sdr.SitDownType == 0)
        {
            Player player = new Player();

            GameRoomModel.GetInstance().waitPlayerDic.Add(sdr.userId.ToString(), player);

            if (sdr.userId.ToString() == GameData.GetInstance().userID)
            {
                GameData.GetInstance().locationIndex = -1;
            }

            GameUserInfoRet gu = GameUserInfoRet.Create(GameRoomModel.GetInstance().playerDic[sdr.locationIndex]);

            gu.locationIndex = -1;

            player.SaveUserInfoToThis(gu);      

            GameRoomModel.GetInstance().playerDic[sdr.locationIndex].ExitRoomDeleteHead();

            GameRoomModel.GetInstance().playerDic.Remove(sdr.locationIndex);
        }
        else if(sdr.SitDownType == 1)
        {
            //如果坐下的是自己， 刷新房间信息，是别人直接生成头像
            if (sdr.userId.ToString() == GameData.GetInstance().userID)
            {
                GameController.GetInstance().downTimeDic.Clear();

                foreach (var item in GameRoomModel.GetInstance().playerDic.Values)
                {
                    if (item.GetDownTime()  !=  0)
                    {
                        Debug.Log(item.userId);
                        downTimeDic.Add(item.userId.ToString(), item.GetDownTime());
                    }
                }

                GameRoomController.GetInstance().OnReceiveMsg127(msg, sdr.gri);

                foreach (var item in GameController.GetInstance().downTimeDic)
                {
                    for (int i = 0; i < GameRoomModel.GetInstance().playerDic.Count; i++)
                    {
                        if (GameRoomModel.GetInstance().playerDic[i].userId.ToString() == item.Key)
                        {
                            GameRoomModel.GetInstance().playerDic[i].ShowDownTime(true, item.Value);
                        }   
                    }
                }

                if (GameRoomModel.GetInstance().playerDic[GameData.GetInstance().locationIndex].TotalScore ==  0)
                {
                    UIManager.ChangeUI(UIManager.PageState.AppendScorePage, (GameObject obj) =>
                    {
                        obj.GetComponent<AppendScorePage>().InformationSetting();
                    });

                    //GameRoomModel.GetInstance().playerDic[GameData.GetInstance().locationIndex].ShowDownTime(true);
                }         
            }
            else  //如果坐下的是别人生成头像
            {
                TooL.LoadPrefab(GameRoomPage.GetInstance().loadPointGroup[intArr[sdr.locationIndex]].
                    gameObject.transform.FindChild("headPoint").gameObject, "playerHead");

                TooL.LoadPrefab(GameRoomPage.GetInstance().loadPointGroup[GameController.GetInstance().intArr[sdr.locationIndex]].
                  gameObject.transform.FindChild("cardPoint").gameObject, "playerCard");

                Player player = GameRoomPage.GetInstance().loadPointGroup[GameController.GetInstance().intArr[sdr.locationIndex]].
                   gameObject.transform.FindChild("headPoint/playerHead").gameObject.AddComponent<Player>();

                GameRoomModel.GetInstance().playerDic.Add(sdr.locationIndex, player);

                GameUserInfoRet gu = GameUserInfoRet.Create(GameRoomModel.GetInstance().waitPlayerDic[sdr.userId.ToString()]);

                gu.locationIndex = sdr.locationIndex;

                player.InitHeadAndNameSaveUserInfo(gu);

                GameRoomModel.GetInstance().waitPlayerDic.Remove(sdr.userId.ToString());        
            }
        }  
    }

    public void OnReceive1233(string msg, Message data)
    {
        TakeInScoreReq tt = (TakeInScoreReq) data;

        if (GameRoomModel.GetInstance().playerDic[tt.LocationIndex].TotalScore== 0)
        {
            GameRoomModel.GetInstance().playerDic[tt.LocationIndex].ShowDownTime(true);
        }
    }


    public void OnReceive1234(string msg, Message data)
    {
        TakeInScoreRet ts = (TakeInScoreRet)data;

        GameRoomModel.GetInstance().playerDic[ts.LocationIndex].ShowDownTime(false);

        if (ts.LocationIndex == GameData.GetInstance().locationIndex)
        {
            if (GameObject.Find("AppendScorePage(Clone)"))
            {
                DestroyImmediate(GameObject.Find("AppendScorePage(Clone)"));
            }          
        }

        GameRoomModel.GetInstance().playerDic[ts.LocationIndex].TotalScore = ts.Score;

        GameRoomModel.GetInstance().playerDic[ts.LocationIndex].approver = ts.Approver;
    }


    public void OnReceive1238(string msg, Message data)
    {
        VieForZhuangRet vf = (VieForZhuangRet) data;

        GameRoomPage.GetInstance().SetVieZhuangBtn(0);
        GameRoomModel.GetInstance().zhuangIndex = vf.LocationIndex;

        GameRoomModel.GetInstance().playerDic[vf.LocationIndex].ShowZhuang(true);

        GameRoomModel.GetInstance().RoomState = 2;
        DownTime.GetInstance().StartDownTime(11);

        if (GameRoomModel.GetInstance().VieForZhuang == true)
            GameRoomController.GetInstance().CheckAutoBetOrPlayerBet();
    }

    public void OnReceive1242(string msg, Message data)
    {
        CurrentWarRecordRet cr = (CurrentWarRecordRet) data;

        if (GameObject.Find("CurrentWarRecordPage(Clone)"))
        {
            CurrentWarRecordPage.GetInstance().Init(cr);
        }
    }

    public void OnReceive1246(string msg, Message data)
    {
        OnceBeforeRet ob = (OnceBeforeRet) data;

        if (GameObject.Find("RoomRulePage(Clone)"))
        {
            RoomRulePage.GetInstance().Init(ob);
        }
    }

    public void OnReceive1240(string msg, Message data)
    {
        MidChangeRoomInfoRet mc = (MidChangeRoomInfoRet) data;

        if (mc.changeType == 1 && mc.maxScore > 0)
        {
            GameRoomModel.GetInstance().MaxTakeInScore = mc.maxScore;
        }
    }

    public void OnReceive1250(string msg, Message data)
    {
        LetSbOutRet lo = (LetSbOutRet)data;
        if (lo.Result)
        {
            if (lo.OutUserId.ToString() == GameData.GetInstance().userID)
            {
                TooL.ShowNoticePage(string.Format("您已被玩家{0}移除房间！",lo.Name));
            }
        }
        else
        {
            if (lo.UserId.ToString() == GameData.GetInstance().userID)
            {
                TooL.ShowNoticePage(string.Format("踢人操作失败！"));
            }
        }
    }

    public void OnReceive1252(string msg, Message data)
    {
        PayEmojiRet pe = (PayEmojiRet) data;

        string name = GetAniName(pe.EmojiNum);

        if (pe.EmojiNum > 13 )
        {
            StartCoroutine(TenAni(name, pe.SendIndex, pe.ReceiveIndex));
        }
        else
        {
            PlayAni(name, pe.SendIndex, pe.ReceiveIndex);
        }
    }

    private  string GetAniName(int num)
    {
        string name = "";
        switch (num)
        {
            case 1:
                name = "face";
                break;
            case 2:
                name = "hand";
                break;
            case 3:
                name = "shoot";
                break;
            case 4:
                name = "egg";
                break;
            case 5:
                name = "book";
                break;
            case 6:
                name = "bang";
                break;
            case 7:
                name = "kiss";
                break;
            case 8:
                name = "flower";
                break;
            case 9:
                name = "boom";
                break;
            case 10:
                name = "cheers";
                break;
            case 11:
                name = "chicken";
                break;
            case 12:
                name = "fish";
                break;
            case 13:
                name = "boss";
                break;
            case 14:
                name = "bang";
                break;
            case 15:
                name = "kiss";
                break;
            case 16:
                name = "flower";
                break;
            case 17:
                name = "boom";
                break;
            case 18:
                name = "cheers";
                break;
            case 19:
                name = "chicken";
                break;
            case 20:
                name = "fish";
                break;
            case 21:
                name = "boss";
                break;
        }
        return name;
    }

    IEnumerator TenAni(string name, int a ,int b)
    {
        for (int i = 0; i < 10; i++)
        {
            PlayAni(name,  a, b);

            yield return new WaitForSeconds(0.5f);
        }
    }

    private void PlayAni(string name, int a, int b)
    {

        var clone = Object.Instantiate(Resources.Load("emojiPerfab/" + name) as GameObject);
        GameObject parentNode = GameObject.Find("AniCamera");

        clone.transform.SetParent(parentNode.transform.GetChild(intArr[a]), false);
        clone.transform.localPosition = new Vector3(0, 0, -5);
        clone.transform.SetParent(parentNode.transform.GetChild(intArr[b]), true);
        clone.transform.DOLocalMove(new Vector3(0, 0,-5), 0.5f);
    }


    #region//瑞杰代码
    public void Get769(string msg, Message date)
    {
        ClubMessageRet cb = (ClubMessageRet)date;

        ////更新俱乐部字典
        //if (cb.Clubs!=null)
        //{
        //    for (int i = 0; i < cb.Clubs.Count; i++)
        //    {
        //        if (!GameData.GetInstance().clubDic.ContainsKey(cb.Clubs[i].ClubName))
        //        {
        //            GameData.GetInstance().clubDic.Add(cb.Clubs[i].ClubName, cb.Clubs[i].Type);
        //        }
        //    }
        //}

        

        GameObject myclub = GameObject.Find("MyClub(Clone)");
        if (myclub)
        {
            SaveDate.GetInstance().AllClub = cb;
            myclub.GetComponent<MyClubbPanel>().SetMyClubbPanel(cb);
        }
        else
        {
            UIManager.ChangeUI(UIManager.PageState.Club, (GameObject obj) =>
            {
                SaveDate.GetInstance().AllClub = cb;
                obj.GetComponent<MyClubbPanel>().SetMyClubbPanel(cb);
            });
        }
    }
    public void Get772(string msg, Message date)
    {

        CreateClubInfo cb = (CreateClubInfo)date;
        string nothing = "";
        if (cb.Type == 0)
            nothing = "您已经创建过俱乐部";
        else if (cb.Type == 1)
        {
            nothing = "每个玩家最多只能同时存在三个俱乐部中";
        }
        else if (cb.Type == 2)
        {
            nothing = "您的金币不足";
        }
        else if (cb.Type == 3)
        {
            nothing = "俱乐部名字重复";
        }
        else if (cb.Type == 4)
        {
            nothing = "服务器异常";
        }
        else if (cb.Type == 5)
        {
            GameObject cl = GameObject.Find("CreateMyClub");
            if (cl)
            {
                //cl.transform.GetChild(3).GetChild(1).GetComponent<Text>().text = "";
                cl.SetActive(false);
            }
            nothing = "恭喜您创建成功";

            GameData.GetInstance().level = 1;
        }
        else { nothing = ""; }
        if (nothing != "")
        {
            TooL.WenXinTiSi(nothing);
            MessageManager.GetInstance().SendMsg768();
        }
    }
    public void Get778(string msg, Message date)
    {
        CheckInfo ci = (CheckInfo)date;
        if (ci.List == null)
        {
            TooL.WenXinTiSi("当前暂时没有人申请");
        }
        else
        {
            UIManager.ChangeUI(UIManager.PageState.Checks, (GameObject obj) =>
            {
                obj.GetComponent<ChecksPanel>().Set(ci, ci.Clubid);
            });
        }
    }
    public void Get780(string msg, Message date)
    {
        SetAdmainRet sr = (SetAdmainRet)date;
        if (sr.type == 0)
        {
            TooL.WenXinTiSi("管理员已经达到上限");
        }
        else if (sr.type == 1)
        {
            TooL.WenXinTiSi("设置失败");
        }
        else if (sr.type == 2)
        {
            TooL.WenXinTiSi("恭喜您，设置成功");
        }
        else if (sr.type == 3)
        {
            TooL.WenXinTiSi("您输入的ID不在俱乐部内");
        }
    }
    public void Get782(string msg, Message date)
    {
        SendMoneyRet sr = (SendMoneyRet)date;
        if (sr.SendRet == 0)
        {
            TooL.WenXinTiSi("转账成功");
        }
        else if (sr.SendRet == 1)
        {
            TooL.WenXinTiSi("转账失败");
        }
        else if (sr.SendRet == 2)
        {
            TooL.WenXinTiSi("您的金币不足");
        }
        else if (sr.SendRet == 3)
        {
            TooL.WenXinTiSi("您转入的ID不存在");
        }
    }
    public void Get785(string msg, Message date)
    {
        JoinClubRet mr = (JoinClubRet)date;
        if (mr.reault == 0)
        {
            TooL.WenXinTiSi("正在申请，请等待审核！");
        }
        else if (mr.reault == 1)
        {
            TooL.WenXinTiSi("俱乐部人数达到上限");
        }
        else if (mr.reault == 3)
        {
            TooL.WenXinTiSi("只能同时申请加入一个俱乐部");
        }
        else if (mr.reault == 4)
        {
            TooL.WenXinTiSi("您加入的俱乐部已经达到上限");
        }
        else if (mr.reault == 2)
        {
            TooL.WenXinTiSi("该俱乐部ID不存在");
        }
        else if (mr.reault == 6)
        {
            TooL.WenXinTiSi("之前的申请正在审核中");
        }
        else if (mr.reault == 5)
        {
            TooL.WenXinTiSi("您已加入该俱乐部");
        }
    }
    public void Get787(string msg, Message date)
    {
        GetOwnerRet mr = (GetOwnerRet)date;
        if (mr.ret == 0)
        {
            GameObject num = GameObject.Find("number_Change");
            if (num)
            {
                num.GetComponent<Text>().text = (int.Parse(num.GetComponent<Text>().text) + 1).ToString();
            }
            if (SaveDate.GetInstance().NUmbers)
            {
                SaveDate.GetInstance().NUmbers.GetComponent<Text>().text = (int.Parse(SaveDate.GetInstance().NUmbers.GetComponent<Text>().text) + 1).ToString();
            }
            TooL.WenXinTiSi("俱乐部加入新成员成功！");
        }
        else if (mr.ret == 1)
        {
            TooL.WenXinTiSi("您已拒绝该成员加入俱乐部");
        }
        else if (mr.ret == 3)
        {
            TooL.WenXinTiSi("成员已达到上限，请联系该成员加入失败");
        }
    }
    public void Get790(string msg, Message date)
    {
        MyIntroRet mr = (MyIntroRet)date;
        GameObject addnode = GameObject.Find("addNode");
        //for (int i = 0; i < addnode.transform.GetChildCount(); i++)
        //{
        //    Destroy(addnode.transform.GetChild(i).gameObject);
        //}
        //UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        //{
        //    obj.GetComponent<GameHallPanel>().InformationSetting();
        //});
        if (mr.result == 0)
        {
            TooL.WenXinTiSi("恭喜您，修改成功!");
        }
        else
        {
            TooL.WenXinTiSi("服务器异常请及时反馈！");
        }
    }
    public void Get792(string msg, Message date)
    {
        DissolveClubInfo mr = (DissolveClubInfo)date;
        GameObject addnode = GameObject.Find("addNode");
        for (int i = 0; i < addnode.transform.GetChildCount(); i++)
        {
            Destroy(addnode.transform.GetChild(i).gameObject);
        }
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
        if (mr.result == 0)
        {
            TooL.WenXinTiSi("恭喜您，解散成功，请返回大厅刷新面板哦！");
        }
        else
        {
            TooL.WenXinTiSi("解散失败！");
        }
    }
    public void Get774(string msg, Message date)
    {
        ClubInfoRets cr = (ClubInfoRets)date;
        SaveDate.GetInstance().ClubInfoRet = cr;
        UIManager.ChangeUI(UIManager.PageState.OtherClubList, (GameObject obj) =>
        {
            obj.GetComponent<ClubLists>().SetList(cr, SaveDate.GetInstance().SeeClubId);
        });
    }
    public void Get796(string msg, Message date)
    {
        UpRet cr = (UpRet)date;
        if (cr.result == 0)
        {
            TooL.WenXinTiSi("您的金币不足！");
            return;
        }
        DesPanel();   
        if (cr.result == 1)
        {
            TooL.WenXinTiSi("升级成功！");
        }
        else if (cr.result == 2)
        {
            TooL.WenXinTiSi("升级失败！");
        }
    }
    public void Get794(string msg, Message date)
    {
        GetwayClubRet cr = (GetwayClubRet)date;
        GameObject addnode = GameObject.Find("addNode");
        for (int i = 0; i < addnode.transform.GetChildCount(); i++)
        {
            Destroy(addnode.transform.GetChild(i).gameObject);
        }
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
        if (cr.ret == 0)
        {
            TooL.WenXinTiSi("退出成功！");
        }
        else if (cr.ret == 1)
        {
            TooL.WenXinTiSi("退出失败！");
        }
    }
    public void Get7113(string msg, Message date)
    {
        LMMunberList cr = (LMMunberList)date;
        if (cr.list == null)
        {
            TooL.WenXinTiSi("当前暂时没有人申请");
        }
        else
        {
            UIManager.ChangeUI(UIManager.PageState.ChecksLm, (GameObject obj) =>
            {
                obj.GetComponent<CheckLmPanel>().Set(cr, cr.allid.ToString());
            });
        }
    }
    public void Get7110(string msg, Message date)
    {
        CreateLMRet cm = (CreateLMRet)date;
        if (cm.ret == 2)
        {
            TooL.WenXinTiSi("金币不足！");
            return;
        }
        else if (cm.ret == 3)
        {
            TooL.WenXinTiSi("联盟名字重复！");
            return;
        }
        DesPanel();
        if (cm.ret == 1)
        {
            TooL.WenXinTiSi("加入联盟达到上限！");
        }
        else if (cm.ret == 0)
        {
            TooL.WenXinTiSi("您已经创建过联盟！");
        }

        else if (cm.ret == 4)
        {
            TooL.WenXinTiSi("服务器异常！");
        }
        else if (cm.ret == 5)
        {
           // TooL.WenXinTiSi("联盟创建成功！");
            GameData.GetInstance().level = 2;
            MessageManager.GetInstance().Send7101();
        }
    }
    public void Get7102(string msg, Message date)
    {
        LmRet lr = (LmRet)date;
        //更新lianmeng字典
        //if (lr.Lmitem != null)
        //{
        //    for (int i = 0; i < lr.Lmitem.Count; i++)
        //    {
        //        if (!GameData.GetInstance().lianMengDic.ContainsKey(lr.Lmitem[i].LmName))
        //        {
        //            GameData.GetInstance().lianMengDic.Add(lr.Lmitem[i].LmName, lr.Lmitem[i].Type);
        //        }
        //    }
        //}
        SaveDate.GetInstance().LmRets = lr;
        UIManager.ChangeUI(UIManager.PageState.LM, (GameObject obj) =>
        {
            obj.GetComponent<MyLegend>().SetMyClubbPanel(lr);
        });
    }
    public void Get7106(string msg, Message date)
    {
        LmNumList cr = (LmNumList)date;
        SaveDate.GetInstance().LmNum = cr;
        UIManager.ChangeUI(UIManager.PageState.OtherLMList, (GameObject obj) =>
        {
            obj.GetComponent<LMNumberList>().SetList(cr, SaveDate.GetInstance().SeeLmId);
        });
    }
    public void Get7108(string msg, Message date)
    {
        JoinAllianceRet mr = (JoinAllianceRet)date;
        if (mr.reault == 0)
        {
            TooL.WenXinTiSi("正在申请，请等待审核！");
        }
        else if (mr.reault == 1)
        {
            TooL.WenXinTiSi("俱乐部人数达到上限");
        }
        else if (mr.reault == 3)
        {
            TooL.WenXinTiSi("只能同时申请加入一个联盟");
        }
        else if (mr.reault == 4)
        {
            TooL.WenXinTiSi("您加入的联盟已经达到上限");
        }
        else if (mr.reault == 2)
        {
            TooL.WenXinTiSi("该联盟ID不存在");
        }
        else if (mr.reault == 6)
        {
            TooL.WenXinTiSi("之前的申请正在审核中");
        }
        else if (mr.reault == 5)
        {
            TooL.WenXinTiSi("您已加入该联盟");
        }
    }
    public void Get7115(string msg, Message date)
    {
        AllianceOpinionRet mr = (AllianceOpinionRet)date;
        if (mr.ret == 0)
        {
            GameObject num = GameObject.Find("number_ChangeLM");
            if (num)
            {
                num.GetComponent<Text>().text = (int.Parse(num.GetComponent<Text>().text) + 1).ToString();
            }
            if (SaveDate.GetInstance().NUmbers)
            {
                SaveDate.GetInstance().NUmbers.GetComponent<Text>().text = (int.Parse(SaveDate.GetInstance().NUmbers.GetComponent<Text>().text) + 1).ToString();
            }
            TooL.WenXinTiSi("加入成功！");
        }
        else if (mr.ret == 1)
        {
            TooL.WenXinTiSi("您已拒绝该成员加入联盟");
        }
        else if (mr.ret == 3)
        {
            TooL.WenXinTiSi("成员已达到上限，请联系该成员加入失败");
        }
    }
    public void Get7117(string msg, Message date)
    {
        AddAdminRet sr = (AddAdminRet)date;
        if (sr.type == 3)
        {
            TooL.WenXinTiSi("管理员已经达到上限");
        }
        else if (sr.type == 2)
        {
            TooL.WenXinTiSi("该ID不是部长");
        }
        else if (sr.type == 4)
        {
            TooL.WenXinTiSi("恭喜您，设置成功");
        }
        else if (sr.type == 1)
        {
            TooL.WenXinTiSi("您输入的ID不存在");
        }
    }
    public void Get7120(string msg, Message date)
    {
        ClearLmRet cr = (ClearLmRet)date;
        DesPanel();
        if (cr.res)
        {
            TooL.WenXinTiSi("解散成功！");
        }
        else
        {
            TooL.WenXinTiSi("解散失败！");
        }
    }
    public void Get7122(string msg, Message date)
    {
        ExitAllianceRet cr = (ExitAllianceRet)date;
        DesPanel();
        if (cr.ret)
        {
            TooL.WenXinTiSi("退出成功！");
        }
        else
        {
            TooL.WenXinTiSi("退出失败！");
        }
    }
    public void Get7124(string msg, Message date)
    {
        UpgradeAllianceRet cr = (UpgradeAllianceRet)date;
        if (cr.result == 0)
        {
            TooL.WenXinTiSi("您的金币不足！");
            return;
        }
        DesPanel();
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
        if (cr.result == 1)
        {
            TooL.WenXinTiSi("升级成功！");
        }
        else if (cr.result == 2)
        {
            TooL.WenXinTiSi("升级失败！");
        }
    }

    public void Get7126(string msg, Message date)
    {
        LMSaidRet lm = (LMSaidRet)date;
        if (!lm.res)
        {
            TooL.WenXinTiSi("修改失败");
        }
        else
        {
            TooL.WenXinTiSi("恭喜您，修改成功！");
        }
    }
    public void Get7130(string msg, Message date)
    {
        LMRenewsRet CR = (LMRenewsRet)date;
        if (CR.result == 0)
        {
            TooL.WenXinTiSi("当前联盟属于初级，不需要续费哦！");
            return;
        }
        DesPanel();
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
        if (CR.result == 1)
        {
            TooL.WenXinTiSi("你当前金币不足，续费失败！");
        }
        else if (CR.result == 2)
        {
            TooL.WenXinTiSi("恭喜您，续费成功！");
        }
        else if (CR.result == 3)
        {
            TooL.WenXinTiSi("服务器异常，续费失败！");
        }
    }
    public void Get7132(string msg, Message date)
    {
        HistoryListRet hr = (HistoryListRet)date;
        SaveDate.GetInstance().ZjAlllist = hr;
        UIManager.ChangeUI(UIManager.PageState.ZhanJi, (GameObject obj) =>
        {
            obj.GetComponent<ZhanJiPanel>().InformationSetting();
            if (hr.historyRooms != null)
            {
                obj.GetComponent<ZhanJiPanel>().SetView(hr.historyRooms.Count);
            }
        });
    }
    public void Get7135(string msg, Message date)
    {
        HistoryRoomMsg hr = (HistoryRoomMsg)date;

        var results = from item in hr.RoomMsg orderby item.ZjInt descending select item;

        List<IsRoomMsg> list = new List<IsRoomMsg>();
       
        foreach (var item in results)
        {
            list.Add(item);
        }

        hr.RoomMsg.Clear();

        hr.RoomMsg = list;

        SaveDate.GetInstance().Roomlist = hr;

        UIManager.ChangeUI(UIManager.PageState.ZhanjiList, (GameObject obj) =>
        {
            obj.GetComponent<LookZhanji>().InformationSetting();
        });
    }
    public void Get7128(string msg, Message date)
    {
        ClubRenewRet CR = (ClubRenewRet)date;
        if (CR.result == 0)
        {
            TooL.WenXinTiSi("当前俱乐部属于初级，不需要续费哦！");
            return;
        }
        DesPanel();
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
        if (CR.result == 1)
        {
            TooL.WenXinTiSi("你当前金币不足，续费失败！");
        }
        else if (CR.result == 2)
        {
            TooL.WenXinTiSi("恭喜您，续费成功！");
        }
        else if (CR.result == 3)
        {
            TooL.WenXinTiSi("服务器异常，续费失败！");
        }
    }
    public void Get7141(string msg, Message date)
    {
        GetRoomMsgRet CR = (GetRoomMsgRet)date;
        SaveDate.GetInstance().GetRoomRet = CR;
        DesAllPanel();
        UIManager.ChangeUI(UIManager.PageState.FaXian, delegate (GameObject target)
        {
            target.GetComponent<FaXianPanel>().InformationSetting();
        });
    }
    public void Get7145(string msg, Message date)
    {
        PhoneRegisterRet CR = (PhoneRegisterRet)date;
        if (CR.Result == 2)
        {
            DesAllPanel(); 
            UIManager.ChangeUI(UIManager.PageState.LoginPage, delegate (GameObject target)
            {
                target.GetComponent<LoginPage>().InformationSetting();
            });
            TooL.WenXinTiSi("该手机号已被注册");
        }
        else if (CR.Result == 3)
        {
            DesAllPanel(); 
            UIManager.ChangeUI(UIManager.PageState.LoginPage, delegate (GameObject target)
            {
                target.GetComponent<LoginPage>().InformationSetting();
            });
            TooL.WenXinTiSi("该手机号不存在");
        }
        //GameObject ts = GameObject.Find("ZuCeTiSi(Clone)");
        //Destroy(ts);
        //GameObject setnumber = Instantiate(Resources.Load("Prefab/Setnumber/Setnumber")) as GameObject;
        //setnumber.transform.SetParent(GameObject.Find("addNode").transform);
        //setnumber.transform.localPosition = Vector3.zero;
        //setnumber.transform.localScale = Vector3.one;
        //setnumber.GetComponent<Setnumber>().SetAcc(CR.pnumber);
    }
    public void Get7147(string msg, Message date)
    {
        VerificationCodeRet CR = (VerificationCodeRet)date;
        if (CR.result == 2)
        {
            TooL.WenXinTiSi("验证码错误");
            return;
        }
        GameObject setnumber = Instantiate(Resources.Load("Prefab/Setnumber/Setnumber")) as GameObject;
        setnumber.transform.SetParent(GameObject.Find("addNode").transform);
        setnumber.transform.localPosition = Vector3.zero;
        setnumber.transform.localScale = Vector3.one;
        setnumber.GetComponent<Setnumber>().SetAcc(CR.phone, SaveDate.GetInstance().ZCMiMa);
    }
    public void Get7150(string msg, Message date)
    {
        AccoutLoginRet CR = (AccoutLoginRet)date;
        if (CR.Result == 2)
        {
            TooL.WenXinTiSi("密码不正确");
        }
        else if (CR.Result == 1)
        {
            TooL.WenXinTiSi("该账号不存在");
        }
    }
    public void Get7152(string msg, Message date)
    {
        ForGetRet CR = (ForGetRet)date;
        if (!CR.ret)
        {
            DesAllPanel();
            UIManager.ChangeUI(UIManager.PageState.LoginPage, delegate (GameObject target)
            {
                target.GetComponent<LoginPage>().InformationSetting();
            });
            TooL.WenXinTiSi("该账号不存在");
        }
    }
    public void Get7154(string msg, Message date)
    {
        ChangePassRet CR = (ChangePassRet)date;
        if (!CR.ret)
        {
            //DesPanel();
            //UIManager.ChangeUI(UIManager.PageState.LoginPage, delegate (GameObject target)
            //{
            //    target.GetComponent<LoginPage>().InformationSetting();
            //});
            TooL.WenXinTiSi("验证码错误");
        }
    }
    public void Get7156(string msg, Message date)
    {
        LiuYanRet CR = (LiuYanRet)date;
        DesPanel();
        if (CR.ret)
        {
            TooL.WenXinTiSi("反馈成功");
        }
        else
        {
            TooL.WenXinTiSi("反馈失败");
        }
    }
    public void Get7157(string msg, Message date)
    {
        SaveDate.GetInstance().Dairu = true;
        GameObject Ts = GameObject.Find("MusicTs(Clone)");
 
        if (Ts)
        {
           
        }
        else
        {
            GameObject musicts = Instantiate(Resources.Load("Prefab/Me/MusicTs")) as GameObject;
            musicts.transform.SetParent(GameObject.Find("Canvas").transform);
            Destroy(musicts, 3);
        }
        if (GameObject.Find("GameRoomPage(Clone)"))
        {
            SaveDate.GetInstance().Dairu = false;
            GetDairu tst = (GetDairu)date;
            var root = GameObject.Find("SpecialCanvas/specialAddNode");
            if (root)
            {
            var tips = TooL.LoadPrefab(root, "ApplyJoinPage");
                ApplyJoinPageEvent script = tips.GetComponent<ApplyJoinPageEvent>();
                script.tst = tst;
            }

            //TooL.
            //    ShowTipsPage(string.Format("玩家{0}({1})申请带入{2}积分", GameRoomModel.GetInstance().playerDic[tst.LocationIndex].userName, GameRoomModel.GetInstance().playerDic[tst.LocationIndex].userId,
            //        tst.Score.ToString()), TooL.TipsPageType.haveCancelPage,
            //    () => { MessageManager.GetInstance().Send7160(true, tst.userId, tst.LocationIndex, tst.roomID); },
            //    () => { MessageManager.GetInstance().Send7160(false, tst.userId, tst.LocationIndex, tst.roomID); });
        }
    }
    public void Get7161(string msg, Message date)
    {
        DairRuRet dr = (DairRuRet)date;
        if (dr.re)
        {
            TooL.WenXinTiSi("批准成功");
        }
        else
        {
            TooL.WenXinTiSi("拒绝成功");
        }
    }
    public void Get7168(string msg, Message date)
    {
        AwayRet dr = (AwayRet)date;
        if (dr.res)
        {
            GameObject num = GameObject.Find("number_Change");
            if (num)
            {
                num.GetComponent<Text>().text = (int.Parse(num.GetComponent<Text>().text) - 1).ToString();
            }
            if (SaveDate.GetInstance().NUmbers)
            {
                SaveDate.GetInstance().NUmbers.GetComponent<Text>().text = (int.Parse(SaveDate.GetInstance().NUmbers.GetComponent<Text>().text) - 1).ToString();
            }
            GameObject nums = GameObject.Find("OtherClubList(Clone)");
            if (nums)
            {
                num.transform.GetChild(1).GetChild(1).GetComponent<Text>().text = (int.Parse(num.GetComponent<Text>().text) - 1).ToString();
            }
            TooL.WenXinTiSi("踢出成功");
        }
        else
        {
            TooL.WenXinTiSi("踢出失败");
        }
    }
    public void Get7170(string msg, Message date)
    {
        AwayLMRet dr = (AwayLMRet)date;
        if (dr.res)
        {
            TooL.WenXinTiSi("踢出成功");
            GameObject num = GameObject.Find("number_ChangeLM");
            if (num)
            {
                num.GetComponent<Text>().text = (int.Parse(num.GetComponent<Text>().text) - 1).ToString();
            }
            if (SaveDate.GetInstance().NUmbers)
            {
                SaveDate.GetInstance().NUmbers.GetComponent<Text>().text = (int.Parse(SaveDate.GetInstance().NUmbers.GetComponent<Text>().text) - 1).ToString();
            }
            GameObject nums = GameObject.Find("OtherLmList(Clone)");
            if (nums)
            {
                string m = nums.transform.GetChild(1).GetChild(1).GetComponent<Text>().text;
                nums.transform.GetChild(1).GetChild(1).GetComponent<Text>().text=(int.Parse(m)-1).ToString();  
            }
        }
        else
        {
            TooL.WenXinTiSi("踢出失败");
        }
    }
    public void Get7164(string msg, Message date)
    {
        ChangeRet dr = (ChangeRet)date;
        if (dr.Res)
        {
            TooL.WenXinTiSi("转换成功");
            GameObject MYgolds = GameObject.Find("MYgold");
            if (MYgolds)
            {
                MYgolds.GetComponent<Text>().text= dr.Money.ToString();
            }
            GameObject MYZhuanShis = GameObject.Find("MYZhuanShi");
            if (MYZhuanShis)
            {
                MYZhuanShis.GetComponent<Text>().text = dr.ZuanShi.ToString();
            }
            GameData.GetInstance().Zhuan = dr.ZuanShi;
            GameData.GetInstance().gold = dr.Money;
        }
        else
        {
            TooL.WenXinTiSi("余额可能不足，转换失败");
        }
    }
    public void Get7165(string msg, Message date)
    {
        GetPeople dr = (GetPeople)date;
        GameObject Ts = GameObject.Find("MusicTs(Clone)");
        if (Ts)
        {
         
        }
        else
        {
            GameObject musicts = Instantiate(Resources.Load("Prefab/Me/MusicTs")) as GameObject;
            musicts.transform.SetParent(GameObject.Find("Canvas").transform);
            Destroy(musicts, 3);
        }
        if (dr._name==0)
        {
            TooL.WenXinTiSi("有人申请加入俱乐部");
            SaveDate.GetInstance().Join = true;
        }
        else
        {
            TooL.WenXinTiSi("有人申请加入联盟");
            SaveDate.GetInstance().JoinLm = true;
        }
    }
    public void Get7159(string msg, Message date)
    {
        Dairilist CR = (Dairilist)date;
        SaveDate.GetInstance().Dairu = false;
        GameData.GetInstance().JoinPageS.Clear();//刷新申请列表时候清空空

        if (CR.dairuLtem != null&& CR.dairuLtem.Count>0)
        {
            GameData.GetInstance().msgRedPoint = true;
            GameObject temp = Instantiate(Resources.Load("SHPrefab/ChecksMsg"))as GameObject;
            temp.transform.SetParent(GameObject.Find("addNode").transform);
            temp.transform.localPosition = Vector3.zero;
            temp.transform.localScale = Vector3.one;
            temp.GetComponent<RectTransform>().offsetMax = Vector2.zero;
            temp.GetComponent<RectTransform>().offsetMin= Vector2.zero;

            //var Conent=temp.transform.Find("Scroll View/Viewport/CheckContent")


            temp.transform.GetChild(2).GetComponent<Button>().onClick.AddListener(delegate {
                GameObject go = GameObject.Find("Image_9");
                if (go)
                {
                    go.SetActive(false);
                }
                Destroy(temp);
            });
            Transform tm = temp.transform.GetChild(1).GetChild(0).GetChild(0);
            for (int i = 0; i < CR.dairuLtem.Count; i++)
            {
                GameObject item = Instantiate(Resources.Load("SHPrefab/MsgItem")) as GameObject;
                //TooL.TipsDialogisOne(CR.dairuLtem[i].Id.ToString());//判断是不是已经有了响应id玩家的申请如果有就删除
                    int id = CR.dairuLtem[i].Id;
                    if (GameData.GetInstance().JoinPageS.ContainsKey(id))
                    {
                        GameObject go = GameData.GetInstance()
                    .JoinPageS[id].gameObject;
                        if (go != null)
                        {
                            Destroy(go);
                        }
                        GameData.GetInstance().JoinPageS.Remove(id);
                    }


                item.transform.SetParent(tm);
                item.transform.localPosition = Vector3.zero;
                item.transform.localScale = Vector3.one;
                item.GetComponent<MsgItem>().Set(CR.dairuLtem[i]);

                GameData.GetInstance().JoinPageS.Add(id, item);
            }
        }
        else
        {
            GameData.GetInstance().msgRedPoint = false;
            TooL.WenXinTiSi("您暂时没有消息需要处理");
        }
    }
    public static void DesPanel()
    {
        GameObject addnode = GameObject.Find("addNode");
        for (int i = 0; i < addnode.transform.childCount;)
        {
            DestroyImmediate(addnode.transform.GetChild(0).gameObject);
        }
        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
    }
    public static void DesAllPanel()
    {
        GameObject addnode = GameObject.Find("addNode");
        for (int i = 0; i < addnode.transform.childCount;)
        {
            DestroyImmediate(addnode.transform.GetChild(0).gameObject);
        }
    }
    #endregion
}
